var postekUrl = "http://127.0.0.1:888/postek/print";
function postekPrint(options, callback) {
    var _options = {
        donecallback: function () {

        },
        alwayscallback: function () {

        },
        done: function (donecallback) {
            this.alwayscallback = donecallback;
            return this;
        },
        always: function (alwayscallback) {
            this.donecallback = alwayscallback;
            return this;
        },
        data: {}
    };

    // _options.data = $.extend({},data,{});
    _options.donecallback = callback;


    $.ajax({
        url: postekUrl,
        method: "post",
        dataType: "json",
        contentType: "application/json",
        timeout:5000,
        data: _options
    }).done(function (data) {
        _options.donecallback.call(_options, data);
    }).always(function () {
        _options.alwayscallback.call(_options);
    });


    return _options;


}